import { Component } from '@angular/core';
import { IonicPage, NavParams } from 'ionic-angular';

import { HideBarsService } from '../../../providers/utils/hideBars.service';

// 工具
import { compareProps } from '../../../utils/basic';
/**
 * 借款详情页面
 */
@IonicPage()
@Component({
  selector: 'page-order-details',
  templateUrl: 'order-details.html',
})
export class OrderDetailsPage {

  private tradeInfo; // 订单详情
  private progressList: any= []; // 进度picker
  constructor(
    private navParams: NavParams,
    private hideBars: HideBarsService,
  )
  {
    this.init();
    // this.moneyObj = {
    //   title : '未还本金',
    //   money : '500',
    //   sum : '1',
    // };
  }
  init()
  {
    const data= this.navParams.get('data');
    const { progress, time, tradeInfo, trade }= data;
    this.progressList= { progress, time };

    debugger;
    const oldArr= [...tradeInfo];
    const arr= oldArr.sort(compareProps('order'));
    this.tradeInfo= [...arr];
  }

  ionViewDidLoad()
  {
  }
  /*** 页面进入
   * */
  ionViewWillEnter()
  {
    this.hideBars.changeTabBarsElementBottom('-5rem');
  }

  /*** 页面离开
   * */
  ionViewWillLeave()
  {
    this.hideBars.changeTabBarsElementBottom('0');
  }
}
